<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<title>Add Load Page </title>
<?php echo link_tag(my_url().'skin.css'); ?>
<?php echo link_tag(my_url().'tcal.css'); ?>
<script type="text/javascript" src="<?php echo my_url(); ?>js/1.js"></script>
<script type="text/javascript" src="<?php echo my_url(); ?>tcal.js"></script> 
<script type="text/javascript" src="<?php echo my_url(); ?>scripts/jquery-1.2.6.js"></script>
<script src="<?php echo my_url(); ?>js/AC_RunActiveContent.js" type="text/javascript"></script>
<script type="text/javascript" src="<?php echo my_url(); ?>jquery.js"></script>

<script language="javascript" type="text/javascript">

 var BaseURL='<?php echo base_url(); ?>';

function redirect(location){
	window.location.href= location;
}
$(document).ready(function(){

 	$("#dv_company_name").change(function(){				

		var _url= BaseURL + "loads/p_getinfo?dv_company_name=" + this.value;

		$.post(_url,"",callbackdisplay);

	});

});

  	

function callbackdisplay(data,status){

		if(status=="success"){
			
			$("#f_name").val(data.f_name);
			$("#cell_phone_num").val(data.cell_phone_num);
			$("#type_of_truck").val(data.type_of_truck);		
			$("#mc_num").val(data.mc_num);		
		}

}

</script>

<script>
var base_url="<?php echo base_url(); ?>";
$(document).ready(function(){
    $('.btnSave').click(function(){
		var isvalid=true;
        data = '';
        	var bc_company_name= document.frmbc.bc_company_name.value;
			var fRet;
			if(bc_company_name== "")
			{
				window.alert("Please enter Companny name");
				document.frmbc.bc_company_name.focus();
				isvalid=false;				
				return false;
			}
			data+="bc_company_name= "  + bc_company_name; 
	$.post(base_url + 'bc/p_add_bc', data,CallBackSave);
    });
});
function CallBackSave(data){
alert("Data Save");	

clearinputs();
//close
//---------------------
		
//clear
}

function clearinputs(){
document.frmbc.bc_company_name.value="";	
}

</script>
<script>
var base_url="<?php echo base_url(); ?>";

$(document).ready(function(){
	
    $('.btnsubmit').click(function(){
		var isvalid=true;
        data = '';
        	var dv_company_name= document.frmdv.dv_company_name.value;
		/*	var dv_n_name= document.frmdv.dv_n_name.value;
			var f_name= document.frmdv.f_name.value;
			var l_name= document.frmdv.l_name.value;
			var address= document.frmdv.address.value;
			var city= document.frmdv.city.value;
			var state= document.frmdv.state.value;
			var zipcode= document.frmdv.zipcode.value;
			var cell_phone_num= document.frmdv.cell_phone_num.value;
			var alt_phone_num= document.frmdv.alt_phone_num.value;
			var office_phone_num= document.frmdv.office_phone_num.value;
			var fax_num= document.frmdv.fax_num.value;
			var email_add= document.frmdv.email_add.value;
			var mc_num= document.frmdv.mc_num.value;
			var rep= document.frmdv.rep.value;
			var dv_comment_box= document.frmdv.dv_comment_box.value;
*/
			var fRet;
					
			if(dv_company_name== "")
			{
				window.alert("Please enter Companny name");
				document.frmdv.dv_company_name.focus();
				isvalid=false;				
				return false;
			}
			data+="dv_company_name= "  + dv_company_name; 
		/*	if(dv_n_name== "")
					{
				window.alert("Please enter Company nick name");
				document.frmdv.dv_n_name.focus();
				return false;
			}
			data+="&dv_n_name= "  + dv_n_name; 			
			if(f_name== "")
			{
				window.alert("Please enter First Name");
				document.frmdv.f_name.focus();
				return false;
			}
			data+="&f_name= "  + f_name; 
			
			if(l_name== "")
			{
				window.alert("Please enter Last Name");
				document.frmdv.l_name.focus();
				return false;
			}
			data+="&l_name= "  + l_name; 
			if(address== "")
			{
				window.alert("Please enter address");
				document.frmdv.address.focus();
				return false;
			}
			data+="&address= "  + address; 
			if(city== "")
			{
				window.alert("Please enter city");
				document.frmdv.city.focus();
				return false;
			}
			data+="&city= "  + city; 
			if(state== "")
			{
				window.alert("Please enter state");
				document.frmdv.state.focus();
				return false;
			}
			data+="&state= "  + state; 
			if(zipcode== "")
			{
				window.alert("Please enter zipcode");
				document.frmdv.zipcode.focus();
				return false;
			}
			data+="&zipcode= "  + zipcode; 
			if(cell_phone_num== "")
			{
				window.alert("Please enter cell_phone_num");
				document.frmdv.cell_phone_num.focus();
				return false;
			}
			data+="&cell_phone_num= "  + cell_phone_num; 
			if(alt_phone_num== "")
			{
				window.alert("Please enter alt_phone_num");
				document.frmdv.alt_phone_num.focus();
				return false;
			}
			data+="&alt_phone_num= "  + alt_phone_num; 
			if(office_phone_num== "")
			{
				window.alert("Please enter office_phone_num");
				document.frmdv.office_phone_num.focus();
				return false;
			}
			data+="&office_phone_num= "  + office_phone_num; 
			if(fax_num== "")
			{
				window.alert("Please enter fax number");
				document.frmdv.fax_nun.focus();
				return false;
			}
			data+="&fax_num= "  + fax_num; 
			if(email_add== "")
			{
				window.alert("Please enter email_add");
				document.frmdv.email_add.focus();
				return false;
			}
			data+="&email_add= "  + email_add; 
			if(rep== "")
			{
				window.alert("Please Select Employee");
				document.frmdv.rep.focus();
				return false;
			}
			data+="&rep= "  + rep; 
			
			if(mc_num== "")
			{
				window.alert("Please enter MC Number");
				document.frmdv.mc_num.focus();
				return false;
			}
			data+="&mc_num= "  + mc_num; 
			if(dv_comment_box== "")
			{
				window.alert("Please enter Comment");
				document.frmdv.dv_comment_box.focus();
				return false;
			}
			data+="&dv_comment_box= "  + dv_comment_box; */

	$.post(base_url + 'dv/p_add_dv', data,CallBackSave);
    });
});


function CallBackSave(data){
alert("Data Save");	


clearinputs();
//close
//---------------------
		
//clear

}

function clearinputs(){
document.frmdv.dv_company_name.value="";	
/*document.frmdv.dv_n_name.value="";
document.frmdv.f_name.value="";
document.frmdv.l_name.value="";
document.frmdv.address.value="";
document.frmdv.city.value="";
document.frmdv.state.value="";
document.frmdv.zipcode.value="";
document.frmdv.cell_phone_num.value="";
document.frmdv.alt_phone_num.value="";
document.frmdv.office_phone_num.value="";
document.frmdv.fax_num.value="";
document.frmdv.email_add.value="";
document.frmdv.mc_num.value="";
document.frmdv.rep.value="";
document.frmdv.dv_comment_box.value="";
*/
//$("#dv_company_name").value("");

}

</script>
<script language="javascript" type="text/javascript">
 var BaseURL='<?php echo base_url(); ?>';
function redirect(location){
	
	window.location.href= location;
}
</script>

<script type="text/javascript" src="<?php echo my_url(); ?>jquery-latest.pack.js"></script>
<script>
$(document).ready(function() {	

	//select all the a tag with name equal to modal
	$('a[name=modal]').click(function(e) {
		//Cancel the link behavior
		e.preventDefault();
		
		//Get the A tag
		var id = $(this).attr('href');
	
		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		//Set heigth and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		
		//transition effect		
		$('#mask').fadeIn(1000);	
		$('#mask').fadeTo("slow",0.8);	
	
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
              
		//Set the popup window to center
		$(id).css('top',  winH/0-$(id).height()/0);
		$(id).css('left', winW/2-$(id).width()/2);
	
		//transition effect
		$(id).fadeIn(2000); 
	
	});
	
	//if close button is clicked
	$('.window .close').click(function (e) {
		//Cancel the link behavior
		e.preventDefault();
		
		$('#mask').hide();
		$('.window').hide();
	});		
	
	//if mask is clicked
	$('#mask').click(function () {
		$(this).hide();
		$('.window').hide();
	});			
	
});

</script>
<style>

a {color:#333; text-decoration:none}
a:hover {color:#ccc; text-decoration:none}

p{
	line-height:20px;
	}
#mask {
  position:absolute;
  left:0;
  top:0;
  z-index:9000;
  background-color:#000;
  display:none;
}
  
#boxes .window {
  	
  position:absolute;
  padding:20px;
  left:0;
  top:50px;
  width:200px;
  height:16px;
  display:none;
  z-index:9999;
  background:#CCC;
  border: 2px solid #F00;
	-moz-border-radius:5px 5px 5px 5px;
	-webkit-border-radius: 5px 5px 5px 5px; 
	-moz-box-shadow: 0px 0px 5px #fff;
	box-shadow: 0px 0px 5px #fff;
	behavior: url(css/ie-css3.htc);
}


#boxes #dialog1 {
  width:550px; 
  height:350px;
  border: 2px solid #FC0;

}

#dialog1 .d-header {
  height:22px;
  
}

#boxes #dialog2 {
  width:550px; 
  height:450px;
  border: 2px solid #FC0;

}

#dialog2 .d-header1 {
  height:22px;
  
}

</style>


<link rel="stylesheet" type="text/css" href="tcal.css" />
<link rel="stylesheet" href="../skin.css" type="text/css" media="screen" /><meta name="author" content="Jaypee Mahilum" />
<link rel="stylesheet" href="style.css" type="text/css" media="screen" />
<link href="skin.css" rel="stylesheet" type="text/css" />
</head>

<?php
//echo $_SESSION['administrator_log']."============";
if(!isset($_SESSION['administrator_log']))
{
		echo"Log in first to access this page<html><title>WARNING</title><body><br><a href='".base_url()."administrator' />click here to log in.</a></body></html>";
}
else
{
?>
<body >


	<div class="BodyCover">
 		<div class="ParentContent">
	        <?php require("owner_menu.php"); ?>
			<div class="MenuTab">
    			<div class="MenuBelow"><img src="<?php echo my_url();?>images/below-menu.gif"></div>        
             </div>
				<div class="title">
                   <h1>Add Load  </h1>
				</div>
			<div class="module-index01">
		  		<div align="right"><a href="<?php echo base_url();?>admin/logout" style="color:#FF0000;">logout</a></div><br/>
  	                <p class=""><?php if (isset($recordflag)) {echo $recordflag;}?><p>

                <form id="frmloads" name="frmloads" action="<?php echo base_url()?>loads/p_add_loads"  method="post">
                <?php if(isset($data_exist)){ echo "<p><label style='color:#F00;'>$data_exist</label></p>";} ?>
                <label>Load_no:</label> <input name="load_no" />
                <label>Date:</label> <input type="text" name="date" class="tcal" value="" />
                <label>Rep:</label> <?php  echo select_list("em_profile","em_n_name","em_n_name","employee_code","","name=rep",""); ?><br />
				<label>B/C Company Name:</label> <?php  echo select_list("bc_profile","bc_company_name","bc_company_name","profile_type='BC'","bc_company_name ASC","name=bc_company_name",""); ?> 	 
                <a href="#dialog1" name="modal"> <img src=" <?php echo my_url() ."images/icons/action_add.gif" ?>" style='border:none'/> Add New Data </a>  <br />  <br />
				<label>Confirmation No.:</label> <input  name="bc_confrm_no" />
				<label>B/C Rate:</label> <input type="textbox" id='currency' name="bc_rate" /> <br />                
                <label>Pick up Place:</label> <input name="pick_up_place" />                
                <label>Pick up City:</label> <input name="pick_up_city" /><br />
                <label>Pick up State:</label> <?php  echo select_list("state","state","state","state_id","","name=pick_up_state",""); ?>
                <label>Pick up Date:</label> <input type="text" name="pick_up_date" class="tcal" value="" /> <br />
                <label>Drop off Place:</label> <input name="drop_off_place" />
                <label>Drop off City:</label> <input name="drop_off_city" /> <br />
                <label>Drop off State:</label> <?php  echo select_list("state","state","state","state_id","","name=drop_off_state",""); ?>
                <label>Drop off Date:</label> <input type="text" name="drop_off_date" class="tcal" value="" /> <br />
                <label>Driver:</label> <?php  echo select_list("dv_profile","dv_company_name","dv_company_name","profile_type='DV'","","name='dv_company_name' id='dv_company_name' ",""); ?> 
                 <a href="#dialog2" name="modal"> <img src=" <?php echo my_url() ."images/icons/action_add.gif" ?>" style='border:none'/> Add New Data </a> <br />
                <label>D/V Rate:</label> <input name="contract_amount"/> <br />
                <label>Driver Name:</label> <input name="f_name" id="f_name"/> 
                <label>Phone number:</label> <input name="cell_phone_num" id="cell_phone_num"/><br /> 
                <label>MC No.:</label> <input name="mc_num" id="mc_num"/> 
                <label>Type of Truck:</label> <input name="type_of_truck" id="type_of_truck"/> <br />
                <label>Comment Box:</label><br /> <textarea name="comment_box" ></textarea><br />
                <input type="file" name="file_path"><br />
                <label>File Confirmation:</label><input name="txtfile_confrm_no"/> <br />                                
				<input type="Submit"  id="btnSaves" class="btnSaves" name="btnSaves" value="Save">
				<input type="button"  value="Cancel" onclick="redirect(BaseURL+'loads')" name="cmdcancel">
				</form>
        
                <div id="boxes">
                        <!-- Start of Login Dialog -->  
                        <div id="dialog1" class="window">
                       
                          <div class="d-header" >
                            <form id="frmbc" name="frmbc" action="<?php echo base_url()?>bc/p_add_bc" method="post">
                                <label>Company Name:</label> <input size="26" name="bc_company_name" />
                                <label> Nick Name:</label> <input size="26" name="bc_n_name" /><br /><br /><br />
                                <label>First Name:</label> <input size="10"name="f_name" /><label> Last Name:</label> <input  size="10" name="l_name" /> <br /><br /><br />
                                <label>Address:</label> <input size="23" name="address" /> <label> City:</label><input size="10" name="city" />
                                <label> State:</label> <?php  echo select_list("state","state","state","state_id","","name=state",""); ?>
                                <label> Zipcode:</label> <input size="5" name="zipcode" /><br /><br /><br />
                                <label>Mobile Number:</label> <input size="18" name="cell_phone_num" />
                                <label>ALT Number: </label> <input size="18"name="alt_phone_num" /><br /><br /><br />
                                <label>Office Number: </label> <input size="18" name="office_phone_num" />
                                <label>Fax Number:</label> <input size="18" name="fax_num" /><br /><br /><br />
                                <label>Email Address:</label> <input size="25" name="email_add" /><label> MC Number:</label> <input size="6" name="mc_num" /> 
                                <label> Rep:</label> <?php  echo select_list("em_profile","em_n_name","em_n_name","employee_code","","name=rep"); ?><br /><br /><br />
                                <label> Comment:</label><br /> <textarea name="bc_comment_box" /> </textarea><br /><br /><br />
                                <input type="button" class="btnSave" id="btnSave" name="btnSave" value="Submit"/>
								<input type="button"  class="close"  value="Close" name="cmdcancel">
                             </form>
                        </div>
                        
                        </div>

                        <!-- End of add bc -->  
                        <!-- Mask to cover the whole screen -->
                          <div id="mask"></div>
                </div>

                <div id="boxes">
                        <!-- Start of Login Dialog -->  
                        <div id="dialog2" class="window">
                       
                          <div class="d-header1" >
                            <form id="frmdv" name="frmdv" action="<?php echo base_url()?>dv/p_add_dv" method="post">
                                <label>Vendor Type:</label> <?php  echo select_list("vendor_type","vendor_type","vendor_type","id","","name=vendor_type"); ?> 
                                <label> Priority No.</label> <?php  echo select_list("priority_no","priority_no","priority_no","id","","name=priority_no"); ?>  <br /> <br />            
                                <label>Company Name:</label> <input name="dv_company_name" /><label> Nick Name:</label> <input name="dv_n_name" /> <br /> <br />                 
                                <label>First Name:</label> <input name="f_name" /> <label> Last Name:</label><input name="l_name" /><br /> <br /> 
                                <label>Address:</label> <input name="address" /><label> City:</label> <input size="10"name="city" />
                                <label>State:</label> <?php  echo select_list("state","state","state","state_id","","name=state",""); ?>
                                <label>Zipcode:</label> <input size="5" name="zipcode" /><br /> <br /> 
                                <label>Mobile Number:</label> <input name="cell_phone_num" /> 
                                <label>Fax Number:</label> <input name="fax_num" /> <br /> <br /> 
                                <label>ALT Number:</label> <input name="alt_phone_num" /> <br /> <br /> 
                                <label>Email Address:</label> <input name="email_add" /><br /> <br /> 
                                <label>Trailer Number:</label> <input name="trailer_num" /> 
                                <label> Type of Truck:</label> <?php  echo select_list("type_of_truck","type_of_truck","type_of_truck","id","","name=type_of_truck",""); ?> <br /> <br /> 
                                <label>Truck Number:</label> <input name="truck_num" />
                                <label>Hasmart:</label> <label> Yes</label><input type="checkbox" name="hazmat" /><label> No</label><input type="checkbox" name="hazmat" /> <br /> <br /> 
                                <label>MC Number:</label> <input name="mc_num" />
                                <label>Warehousing:</label> <label> Yes</label><input type="checkbox" name="hazmat" /><label> No</label><input type="checkbox" name="hazmat" /> <br /> <br />                
                                <label>DOT NO.:</label> <input name="dot_no" /> <br /> <br /> 
                                <label>Insurance Coverage Amount:</label> <input name="i_c_a" /> <br /> <br /> 
                                <label>Rep:</label> <?php  echo select_list("em_profile","em_n_name","em_n_name","employee_code","","name=rep",""); ?> <br /> <br />                
                                <label>Comment:</label><br /><textarea name="dv_comment_box" /> </textarea><br /> <br /> 
                                <input type="button" class="btnsubmit" id="btnsubmit" name="btnsubmit" value="Submit"/>
                                <input type="button"  class="close"  value="Close" name="cmdcancel">		
		                </form>
                        </div>
                        
                        </div>

                        <!-- End of add bc -->  
                        <!-- Mask to cover the whole screen -->
                          <div id="mask"></div>
                </div>
    		<br>
		
            <div class="BodyContent">
            </div>	
			    		
		    <div class="Footer1">	
                <div class="Footer">Copyright &copy; 2011. All Rights Reserved <br><br>
                 <a href="http://webmartis.com"> <img src="<?php echo my_url();?>/images/wmlink.png"></a>
                 
                </div>                
            </div> <!---end of Footer1 ---->        
            
		</div><!---end of ParentContent ---->
    </div> <!---end of BodyCover ---->
</body>
<?php } ?>
</html>

